<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<div class="t_bar">
	<span class="color_red">*</span>项目贷款情况
</div>
<table class="t_css" width="100%" border="0" cellpadding="0" cellspacing="1"  id="loan_sicuation">
	<tr>
		<td width="20%" align="right" nowrap>单位名称：</td>
		<td colspan="3" width="80%">&nbsp;<span name="organizations/organization[0]/org_name"><x:out select="$xmlData/data/organizations/organization[@submit_org='1']/org_name" />
		    </span>
		</td>
	</tr>
	<tr>
		<td width="20%" align="right" nowrap>项目名称：</td>
		<td colspan="3">&nbsp;<span id="loan_prp_title"><x:out select="$xmlData/data/proposal/zh_title" /></span>
		</td>
	</tr>
	<tr class="li_1">
            <td align="right" width="20%">贷款银行：</td>
            <td align="left" colspan="1" width="30%">&nbsp;
               <input name="prp_fund/loan_bank_name" class="required" label="贷款银行" value="<x:out select="$xmlData/data/prp_fund/loan_bank_name" />">
            </td>
            <td align="right" width="20%">银行开户账号：</td>
            <td align="left" width="30%">&nbsp;
                <input name="prp_fund/loan_bank_account" class="required" label="银行开户账号"  value="<x:out select="$xmlData/data/prp_fund/loan_bank_account" />">
            </td>          
      </tr> 
</table>
<table  id="tblEuipmentLists" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<thead >
					<tr style="border:1px solid #B7D1E6">
						<th class="TblHead" align="center"  width="6%">选择</th>
						<th class="TblHead" align="center"  width="6%">序号</th>
						<th class="TblHead" align="center"  width="16%">合同号码</th> 
						<th class="TblHead" align="center"  width="12%">贷款日期</th> 
				        <th class="TblHead" align="center"  width="12%">到期日期</th> 
						<th class="TblHead" align="center"  width="12%">贷款额度<br/>（万元）</th>
						<th class="TblHead" align="center"  width="12%">贷款利率（%）</th>
						<th class="TblHead" align="center"  width="12%">已还款金额<br/>（万元）</th>  
						<th class="TblHead" align="center"  width="12%">已付利息<br/>（万元）</th>
					</tr>
			</thead>
			<tbody id="tab">
					<tr style="display:none" align="center">
						<td align="center">
							<input type="radio" class="radiobutton" name="selEuipmentLists" >
						</td>
						<td align="center">
							<span name="contracts|list[0]@seq_no" >[index]</span> 
						</td>
						<td align="center">
							<input type="text" name="contracts|list[0]|contract_no" label="合同号码" class=" required input_text " maxlength="50" style="width:80%"/>
						</td>
						<td nowrap align="center"><input  id="loan_date_[0]" name="contracts|list[0]|loan_date" label="贷款日期" value="" class=" required input_text date " style="width:65px" /></td>
						<td nowrap align="center"><input  id="ot_date_[0]" name="contracts|list[0]|ot_date" label="到期日期" value="" class=" required input_text date " style="width:65px" /></td>
						<td align="center">
							<input type="text"id="loan_count_[0]"  name="contracts|list[0]|loan_count" label="贷款额度" onfocus="InitInput.setNumber(this,7,4,2)" onchange="countjsTable2('tblEuipmentLists');"  style="text-align:right;width:80%" class=" input_text required" />
						</td> 
						<td align="center">
							<input type="text" name="contracts|list[0]|loan_pre" label="贷款利率"  id="loan_pre_[0]"  onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right;width:80%" class="valueLENum:loan_pre_[0]:100 input_text required" />
						</td>
						<td align="center">
							<input type="text" id="loan_pay_[0]" name="contracts|list[0]|loan_pay"  label="已还款金额" onchange="countjsTable2('tblEuipmentLists');" onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right;width:80%" class=" input_text required  valueGreatEqual:loan_count_[0]:loan_pay_[0]" />
						</td> 
						<td align="center">
							<input type="text" name="contracts|list[0]|loan_pay_pre" label="已付利息" onchange="countjsTable2('tblEuipmentLists');" onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right;width:80%" class=" input_text required " />
						</td>
					</tr>
					
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/contracts/list" var="list">
					
					<c:choose>
						<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
						<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
					</c:choose>
					<tr align="center">
						<td>
							<input type="radio" class="radiobutton" name="selEuipmentLists" >
						</td>
						<td>
							<span name="contracts/list[${flag}${index}]@seq_no" ><x:out select="$list/@seq_no"/></span> 
						</td>
						<td>
							<input type="text" name="contracts/list[${flag}${index}]/contract_no"  label="合同号码" style="width:80%"   class=" input_text required" value="<x:out select="$list/contract_no" />" maxlength="50"/>
						</td>
						<td nowrap><c:set var="loan_date" scope="page"><x:out select="$list/loan_date"/></c:set>
							<input  id="loan_date_[${flag}${index}]" value="${loan_date}" name="contracts/list[${flag}${index}]/loan_date" class="required date input_text" style="width:65px" label="贷款日期" /> 
						</td>
						<td nowrap><c:set var="ot_date" scope="page"><x:out select="$list/ot_date"/></c:set>
							<input  id="ot_date_[${flag}${index}]" value="${ot_date}" name="contracts/list[${flag}${index}]/ot_date" class="required date input_text" style="width:65px" label="到期日期" /> 
						</td>
						
						<td >
							<input type="text" name="contracts/list[${flag}${index}]/loan_count" id="loan_count[${flag}${index}]" label="贷款额度" onchange="countjsTable2('tblEuipmentLists');"  onfocus="InitInput.setNumber(this,7,4,2)"   style="text-align:right;width:80%"  class=" input_text required" value="<x:out select="$list/loan_count" />"/>
						</td> 
						<td >
							<input type="text" name="contracts/list[${flag}${index}]/loan_pre" id="loan_pre[${flag}${index}]" label="贷款利率"  onfocus="InitInput.setNumber(this,7,4,2)"   style="text-align:right;width:80%"  class="valueLENum:loan_pre[${flag}${index}]:100 input_text required" value="<x:out select="$list/loan_pre" />"/>
						</td>
						<td >
							<input type="text" id="loan_pay[${flag}${index}]" name="contracts/list[${flag}${index}]/loan_pay"  label="已还款金额"  onchange="countjsTable2('tblEuipmentLists');" onfocus="InitInput.setNumber(this,7,4,2)"  style="text-align:right;width:80%"  class=" input_text required valueGreatEqual:loan_count[${flag}${index}]:loan_pay[${flag}${index}]" value="<x:out select="$list/loan_pay" />"/>
						</td> 
						<td >
							<input type="text" name="contracts/list[${flag}${index}]/loan_pay_pre"  label="已付利息" onchange="countjsTable2('tblEuipmentLists');" onfocus="InitInput.setNumber(this,7,4,2)"  style="text-align:right;width:80%"  class=" input_text required" value="<x:out select="$list/loan_pay_pre" />"/>
						</td> 
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
					<script type="text/javascript">
						showAllDateTag("tblEuipmentLists");
					</script>
				</tbody>
					</table>
					<table   cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="border-bottom: #a1c0dc 1px solid;" id="tblEuipmentLists1">
					<tr align="center">
					<td style="width:28%">合计</td>
					<td style="width:12%">\</td>
					<td style="width:12%">\</td>
					<td style="width:12%">\<input type="hidden" name="contracts_list/loan_count_total" id="loan_count_total" value="<x:out select="$xmlData/data/contracts_list/loan_count_total" />" class="gray input_text"  style="text-align:right; width:80%" disabled  onfocus="InitInput.setNumber(this,7,4,2)" /></td>
					<td style="width:12%">\</td>
					<td style="width:12%"><input name="contracts_list/loan_pay_count" id="loan_pay_count" value="<x:out select="$xmlData/data/contracts_list/loan_pay_count" />" disabled class="gray input_text" style="text-align:right; width:80%" onfocus="InitInput.setNumber(this,7,4,2)" /></td>
					<td style="width:12%"><input name="contracts_list/loan_pay_pre" id="loan_pay_pre" value="<x:out select="$xmlData/data/contracts_list/loan_pay_pre" />" class="gray input_text"  style="text-align:right; width:80%" disabled  onfocus="InitInput.setNumber(this,7,4,2)" /></td>
					</tr>
					</table>
				<table width="98%" align="center">
				<tr ><td>
				<input class="button" name="cmdAddbefore" type=button value="添加" onclick="addNewRow('tblEuipmentLists');showDateTag('tblEuipmentLists');try{top.resizeFrame();}catch(e){};">
				<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblEuipmentLists','selEuipmentLists')">
				<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblEuipmentLists','selEuipmentLists')">
				<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblEuipmentLists','附表1：设备清单明细表');countjsTable2('tblEuipmentLists');">
				</td></tr>
	</table>	

<br/>

<script type="text/javascript">
$(document).ready(function() {
var prp_version=$("#prp_version").text();

if(prp_version==""||prp_version==null){
	$("#budgetsMsg").find(":input").each(function(){
	$(this).val("0.00");	
	});
	
	$("#budgetsMsg1").find(":input").each(function(){
		$(this).val("0.00");	
		});
	
	 $("#fundAdds").find(":input[type!=hidden]").each(function(){
		/* $(this).val("0.00");	 */
		$("input[id^='total_total_']").val("0.00");	
		});
}
});

function synchro(){
	var source_apply = $("#source_apply").val();
	var source_total = $("#source_total").val();
	var source_already = $("#source_already").val();
	$("#sqje").val(formatVal2(source_apply));
	$("#investment_budget").val(formatVal2(source_total));
	$("#finsh_budget").val(formatVal2(source_already));
	  
	
}

function countjsTable2(tblId){
	  
	   var count7=0;
	   var count8=0;
	   var count6=0;
	   $("#"+tblId+" tr:gt(1)").each(function() {
		   var fund6 = $(this).children().eq("5").children().val();
		   var fund7 = $(this).children().eq("7").children().val();
		   var fund8 = $(this).children().eq("8").children().val();
		   
		   if (!$.isNumeric(fund6))  fund6 = "0";
		   if (!$.isNumeric(fund7))  fund7 = "0";
		   if (!$.isNumeric(fund8)) fund8 = "0";
		   count6 = ((parseFloat(count6)*10000 + parseFloat(fund6)*10000)/10000).toFixed(4);
		   count7 = ((parseFloat(count7)*10000 + parseFloat(fund7)*10000)/10000).toFixed(4);
		   count8 = ((parseFloat(count8)*10000 + parseFloat(fund8)*10000)/10000).toFixed(4);
    });
	   count6 = formatNumberAuto(count6.toString(), 9, 4, 2);// 格式化金额
	   count7 = formatNumberAuto(count7.toString(), 9, 4, 2);// 格式化金额
	   count8 = formatNumberAuto(count8.toString(), 9, 4, 2);// 格式化金额
   	$("#loan_pay_count").val(count7); 
	$("#loan_pay_pre").val(count8); 
	$("#loan_count_total").val(count6);
}



</script>
